cmake_minimum_required (VERSION 3.10)
project(VsomeipServer)

find_package(Threads REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -g3")

file(GLOB_RECURSE LOGCI_LIGIC_SRCS    ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

set(VsomeipServer_SRCS
  ${LOGCI_LIGIC_SRCS}
  ${TESTCASES_SRCS}
  ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
)

link_directories(
  ${BOOST_LIB_DIR}
  ${VSOMEIP_LIB_DIR}
)

add_executable(VsomeipServer ${VsomeipServer_SRCS})

# Ensure dynamic linking namespace for Boost.Log matches libraries (avoid v2s_mt_posix mismatch)
target_compile_definitions(VsomeipServer PRIVATE BOOST_LOG_DYN_LINK BOOST_LOG_SETUP_DYN_LINK)

# Add include header files
set(${PROJECT_NAME}_INCLUDE_DIRS)

# ---------- Start to Add include directories: Aptiv Platform -------------
# Add include header files belongs to Aptiv Platform paths
#list(APPEND ${PROJECT_NAME}_INCLUDE_DIRS ${${PROJECT_NAME}_INCLUDE_DIRS} ${APTIV_PLATFORM_INCLUDE_ROOT}/)
# ---------- Start to Add include directories: Aptiv Platform -------------
target_include_directories(VsomeipServer   PUBLIC  
	${${PROJECT_NAME}_INCLUDE_DIRS}
)


include_directories (
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${VSOMEIP_INCLUDE_DIR}
  ${CMAKE_THREAD_LIBS_INIT}
)


target_link_libraries(VsomeipServer
  vsomeip3
  ${CMAKE_THREAD_LIBS_INIT}
  pthread
  boost_log
  boost_log_setup
  boost_filesystem
  boost_thread
  boost_atomic
  boost_chrono
  boost_date_time
  boost_regex
  boost_system
)

set_target_properties(VsomeipServer PROPERTIES
  BUILD_RPATH "${BOOST_LIB_DIR};${VSOMEIP_LIB_DIR}"
)





